package com.huobao.yunying.utils;

import android.content.Context;
import android.content.SharedPreferences;

public class UserUtils {

	public static void save(Context context,int userid, int role){
		SharedPreferences preferences = getPrefences(context);
		preferences.edit().putInt("userid", userid).putInt("role", role).commit();
	}
	private static SharedPreferences getPrefences(Context context){
		SharedPreferences preferences = context.getSharedPreferences("user", 0);
		return preferences;
	}
	public static int getUserid(Context context){
		return getPrefences(context).getInt("userid", -1);
	}
	public static int getUserRole(Context context){
		return getPrefences(context).getInt("role", -1);
	}
}
